export default function myMsgReducer(state, action){
    console.log("myMsgReducer.....",state,action)
    if (action.type==="DEL_MSG"){
        console.log("开始删除",action.index,state)
        return {
            msgs: [...state.slice(0,action.index),...state.slice(action.index+1, state.length)]
        }
    }else if(action.type==="ADD_MSG"){
        const newMsgs = state.msgs.concat(action.msg);
        console.log("newMsgs.....",newMsgs,action.msg)
        return  {
            msgs:newMsgs
        }
    }
    else{
        return state;
    }
}